// pages/advertisement/advertisement.js
var app = getApp();
var rootDocment = app.globalData.postUrl;
Page({
  data: {
    advertising: true,
    time: 5, //倒计时 秒
    adImgUrls: ''
    //开屏广告
  },

  jmp: function () {
    
    // wx.showTabBar({
    //   animation: true //动画效果
    // });
    wx.hideTabBar();
    wx.switchTab({
      url: '/pages/index/index',
    })
    this.setData({
      advertising: false
    });
    clearInterval(this.x); //清除定时器
    
  }, //跳过广告
  onLoad: function () {
    var that = this
    wx.hideTabBar(); // 隐藏底部按钮
    this.x = setInterval(function () {
      that.setData({
        time: that.data.time - 1
      })
      if (that.data.time == 0)
        that.jmp()
    }, 1000) //每秒执行一次  
    this.setSlideData()
  },
  setSlideData: function () {
    var that = this;
    var paraArr = new Array();

    var sign = app.signature(paraArr);
    wx.request({
      url: rootDocment + '/api/llgn/getAds',
      data: {
        sign: sign
      },
      method: 'GET',
      header: {},
      success: function (res) {
        console.log(res,'广告')
        that.setData({
          // isShow:false,
          adImgUrls: res.data.data.start_pic
        });
      }
    })
  },
})